import React, { Component } from 'react'
import MovieList from './views/MovieList'
import Detail  from './views/Detail'
export default class App extends Component {
  state={
    movieItem:null
  }
  getMovieItemFromMovieList=(data)=>{
    this.setState(()=>{
      return{
        movieItem:data
      }
    })
  }
  render() {
    return (
      <div style={{display:'flex'}}>
        <MovieList callback={this.getMovieItemFromMovieList}></MovieList>
        {/* 从父组件传递对象到子组件中，这里边使用的是展开运算符的方式 */}
        <Detail {...this.state.movieItem}></Detail>
      </div>
    )
  }
}
